package HomeWork.day05;

import java.io.File;
import java.io.FileFilter;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * 列出当前目录中所有名字包含s的子项。
 * 
 * 使用匿名内部类和lambda两种写法
 * 
 * 单词记一记:
 * FileFilter   文件过滤器
 * accept       接受
 * 
 * @author Xiloer
 *
 */
public class Test02 {
	public static void main(String[] args) throws FileNotFoundException {
		File file = new File(".");
		if(file.isFile()) {
			/*FileFilter filter = new FileFilter() {
				@Override
				public boolean accept(File pathname) {
					String name = pathname.getName();
					boolean s = name.contains("s");
					return s;
				}
			};
			File[] subs = file.listFiles(filter);
			*/
			File[] subs = file.listFiles(pathname->pathname.getName().contains("e"));
			for(File sub:subs){
				System.out.println(sub.getName());
			}
		}
	}
}
